package rpg;
import javax.microedition.lcdui.Image;
public class Enemy 
{
	int HP,LVL,basicPower,basicDefence,x,y;
	int p;
	int experience;
	int momey;
	Image enemy;
	public static Image imgEnemies;
	public static Image imgFightBoss;
	public static Image imgFightPlayer;
	
	public Enemy(int level)
	{
		try{
			if(imgEnemies==null)
			imgEnemies=Image.createImage("/enemy.png");
		}
		catch(Exception e){
			System.out.println("Error occurs when creating enemy pictures");
		}
		this.LVL=level;
		this.HP=level*level+60*level;
		this.basicPower=30*level;
		this.basicDefence=15*level;
		this.experience=15*level;
		this.momey=LVL*LVL+5*LVL;
		this.enemy=Image.createImage(imgEnemies,(LVL-1)%5*40,(LVL-1)/5*50,40,50,0);
	}
	public Enemy(int i,int a)
	{
		try{
			if(imgEnemies==null)
			imgEnemies=Image.createImage("/enemy.png");
		}
		catch(Exception e){
			System.out.println("Error occurs when creating enemy pictures");
		}
		this.HP=i;
		this.basicPower=a;
		this.LVL=11;
		this.experience=20*LVL;
		this.basicDefence=2*LVL+3;
		this.momey=LVL*LVL+5*LVL;
	}
	public Enemy(int level,int x,int y)
	{
		try{
			if(imgEnemies==null)
				imgEnemies=Image.createImage("/enemy.png");
			if(imgFightBoss==null)
				imgFightBoss=imgFightBoss=Image.createImage("/boss.png");
			if(imgFightPlayer==null)
				imgFightPlayer=Image.createImage("/fightPlayer.png");
		}
		catch(Exception e){
			System.out.println("Error occurs when creating enemy pictures");
		}
		this.x=x;
		this.y=y;
		this.LVL=level;
		this.HP=level*level+60*level-30;
		this.basicPower=30*level-20;
		this.basicDefence=15*level-5;
		this.experience=15*level;
		if(level<20)
			this.enemy=Image.createImage(imgEnemies,(LVL-1)%5*40,(LVL-1)/5*50,40,50,0);
		else{
			if(level==20)
				this.enemy=Image.createImage(Image.createImage(imgFightPlayer,144,0,48,60,0));
			else if(level==21)
				this.enemy=Image.createImage(Image.createImage(imgFightBoss,0,0,60,80,0));
			else if(level==23)
				this.enemy=Image.createImage(Image.createImage(imgFightBoss,60,0,60,80,0));
		}
		this.momey=LVL*LVL+5*LVL;
	}
}